@echo off
setlocal enabledelayedexpansion

echo ==========================================
echo JAR Updater - Windows EXE Builder
echo ==========================================
echo.

python --version >nul 2>&1
if %errorlevel% neq 0 (
    echo ERROR: Python not found!
    echo Please install Python 3.x from python.org
    pause
    exit /b 1
)

echo Step 1: Install dependencies...
python -m pip install --quiet --upgrade pip
python -m pip install --quiet pyinstaller
python -m pip install --quiet -r requirements.txt

echo.
echo Step 2: Clean old builds...
if exist build rmdir /s /q build 2>nul
if exist dist rmdir /s /q dist 2>nul

echo.
echo Step 3: Build EXE file...
pyinstaller jar-updater.spec

if %errorlevel% neq 0 (
    echo.
    echo ERROR: Build failed!
    pause
    exit /b 1
)

echo.
echo ==========================================
echo BUILD SUCCESS!
echo ==========================================
echo.
echo Output: dist\JAR-Updater.exe
echo.
pause

